Ext.define('SKJF.view.PENJUALAN.v_salesrtn_form', {
	extend	: 'Ext.form.Panel',
	
	alias	: 'widget.v_salesrtn_form',
	
	//region:'east',
	//id: 'east-region-container',
	
	title		: 'Create/Update salesrtn',
    bodyPadding	: 5,
    autoScroll	: true,
    
    initComponent: function(){
    	/*
		 * Deklarasi variable setiap field
		 */
		
		var currency_store = Ext.create('SKJF.store.s_mstcurrency',{autoLoad:true});
		
		var NOMOR_SALES_RETURN_field = Ext.create('Ext.form.field.Text', {
			itemId: 'NOMOR_SALES_RETURN_field',
			name: 'NOMOR_SALES_RETURN', /* column name of table */
			fieldLabel: 'NOMOR_SALES_RETURN',
			allowBlank: false,
		});
		var TANGGAL_SALES_RETURN_field = Ext.create('Ext.form.field.Date', {
			name: 'TANGGAL_SALES_RETURN', /* column name of table */
			format: 'Y-m-d',
			fieldLabel: 'TANGGAL_SALES_RETURN'
		});
		var NOMOR_DO_field = Ext.create('Ext.form.field.Text', {
			name: 'NOMOR_DO', /* column name of table */
			fieldLabel: 'NOMOR_DO'
		});
		var KODE_CUSTOMER_field = Ext.create('Ext.form.field.Text', {
			name: 'KODE_CUSTOMER', /* column name of table */
			fieldLabel: 'KODE_CUSTOMER'
		});
		var NAMA_CUSTOMER_field = Ext.create('Ext.form.field.Text', {
			name: 'NAMA_CUSTOMER', /* column name of table */
			fieldLabel: 'NAMA_CUSTOMER'
		});
		var ALAMAT_CUSTOMER_field = Ext.create('Ext.form.field.Text', {
			name: 'ALAMAT_CUSTOMER', /* column name of table */
			fieldLabel: 'ALAMAT_CUSTOMER'
		});
		var KOTA_CUSTOMER_field = Ext.create('Ext.form.field.Text', {
			name: 'KOTA_CUSTOMER', /* column name of table */
			fieldLabel: 'KOTA_CUSTOMER',
			maxLength: 50 /* length of column name */
		});
		var TELPON_CUSTOMER_field = Ext.create('Ext.form.field.Text', {
			name: 'TELPON_CUSTOMER', /* column name of table */
			fieldLabel: 'TELPON_CUSTOMER'
		});
		var FAX_CUSTOMER_field = Ext.create('Ext.form.field.Text', {
			name: 'FAX_CUSTOMER', /* column name of table */
			fieldLabel: 'FAX_CUSTOMER'
		});
		var CURRENCY_field = Ext.create('Ext.form.field.Text', {
			name: 'CURRENCY', /* column name of table */
			fieldLabel: 'CURRENCY',
			pageSize: 10,
			typeAhead    : true,
			triggerAction: 'all',
			selectOnFocus: true,
            loadingText  : 'Searching...',
			store: currency_store,
			queryMode: 'local',
			tpl: Ext.create('Ext.XTemplate',
				'<tpl for=".">',
					'<div class="x-boundlist-item">{CURRENCY} - {NEGARA}</div>',
				'</tpl>'
			),
			displayTpl: Ext.create('Ext.XTemplate',
				'<tpl for=".">',
					'{CURRENCY} - {NEGARA}',
				'</tpl>'
			),
			valueField: 'CURRENCY',
			displayField: 'CURRENCY'
		});
		var KURS_field = Ext.create('Ext.form.field.Number', {
			name: 'KURS', /* column name of table */
			fieldLabel: 'KURS',
			maxLength: 11 /* length of column name */
		});
		var SUB_TOTAL_field = Ext.create('Ext.ux.form.NumericField', {
			name: 'SUB_TOTAL', /* column name of table */
			fieldLabel: 'SUB_TOTAL',
			useThousandSeparator: true,
			decimalPrecision: 2,
			alwaysDisplayDecimals: true,
			// currencySymbol: 'Rp',
			thousandSeparator: '.',
			decimalSeparator: ',',
			readOnly: true
		});
		var PPN_field = Ext.create('Ext.ux.form.NumericField', {
			name: 'PPN', /* column name of table */
			fieldLabel: 'PPN',
			useThousandSeparator: true,
			decimalPrecision: 2,
			alwaysDisplayDecimals: true,
			// currencySymbol: 'Rp',
			thousandSeparator: '.',
			decimalSeparator: ','
		});
		var TOTAL_field = Ext.create('Ext.ux.form.NumericField', {
			name: 'TOTAL', /* column name of table */
			fieldLabel: 'TOTAL',
			useThousandSeparator: true,
			decimalPrecision: 2,
			alwaysDisplayDecimals: true,
			// currencySymbol: 'Rp',
			thousandSeparator: '.',
			decimalSeparator: ',',
			readOnly: true
		});
		var MATERAI_field = Ext.create('Ext.form.field.Number', {
			name: 'MATERAI', /* column name of table */
			fieldLabel: 'MATERAI',
			maxLength: 11 /* length of column name */
		});
		var DIBUAT_OLEH_field = Ext.create('Ext.form.field.Text', {
			name: 'DIBUAT_OLEH', /* column name of table */
			fieldLabel: 'DIBUAT_OLEH',
			readOnly: true
		});
		var JUMLAH_EDIT_field = Ext.create('Ext.form.field.Number', {
			name: 'JUMLAH_EDIT', /* column name of table */
			fieldLabel: 'JUMLAH_EDIT',
			readOnly: true
		});
		var TANGGAL_EDIT_field = Ext.create('Ext.form.field.Date', {
			name: 'TANGGAL_EDIT', /* column name of table */
			format: 'Y-m-d',
			fieldLabel: 'TANGGAL_EDIT',
			readOnly: true
		});
		var INFO_field = Ext.create('Ext.form.field.Text', {
			name: 'INFO', /* column name of table */
			fieldLabel: 'INFO',
			maxLength: 50 /* length of column name */
		});		
        Ext.apply(this, {
            fieldDefaults: {
                labelAlign: 'right',
                labelWidth: 120,
                msgTarget: 'qtip',
				anchor: '100%'
            },
			defaultType: 'textfield',
            items: [NOMOR_SALES_RETURN_field,TANGGAL_SALES_RETURN_field,NOMOR_DO_field,KODE_CUSTOMER_field,NAMA_CUSTOMER_field,ALAMAT_CUSTOMER_field,KOTA_CUSTOMER_field,TELPON_CUSTOMER_field,FAX_CUSTOMER_field,CURRENCY_field,KURS_field,SUB_TOTAL_field,PPN_field,TOTAL_field,MATERAI_field,DIBUAT_OLEH_field,JUMLAH_EDIT_field,TANGGAL_EDIT_field,INFO_field],
			
	        buttons: [{
                iconCls: 'icon-save',
                itemId: 'save',
                text: 'Save',
                disabled: true,
                action: 'save'
            }, {
                iconCls: 'icon-add',
				itemId: 'create',
                text: 'Create',
                action: 'create'
            }, {
                iconCls: 'icon-reset',
                text: 'Cancel',
                action: 'cancel'
            }]
        });
        
        this.callParent();
    }
});